<template>
	<view style="position: relative;height: 100%;">
		<view>
			<image :src="biao_tou" mode=""  style="width:750rpx;height:260.9rpx;"></image>
		</view>
		<view style="position: absolute;z-index: 12;top: 109rpx;box-sizing: border-box;padding: 0 30.2rpx;display: flex;width: 100%;height: 30.2rpx;align-items: center;font-size: 30.2rpx;color: #FFFFFF;font-weight: bold;justify-content: center;">
			<view>
				我的
			</view>
		</view>
		<view style="width: 694.6rpx;position: relative;background: #FFFFFF;border-radius: 30.2rpx;left: 27.77rpx;padding: 40.5rpx 30rpx 40rpx 35rpx;box-sizing: border-box;top: -100rpx;">
			<view style="display: flex;">
				<view v-if="dad" style="display: flex;justify-content: space-between;align-items: center;">
					<view>
						<image :src="dad.avatar" style="width: 115.6rpx;height: 115.6rpx;border-radius: 50%;border: 0.01rpx solid #DBDBDB;" v-if="gou_yong == 12"></image>
						<image :src="mechanism_logo" style="width: 115.6rpx;height: 115.6rpx;border-radius: 50%;border: 0.01rpx solid #DBDBDB;" v-if="gou_yong == 22"></image>
					</view>
					<view style="margin-left: 10rpx;display: flex;justify-content: space-between;align-items: center;min-width: 500rpx;">
						<view>
							<view v-if="gou_yong == 12">
								<view style="font-size: 30rpx;font-weight: bold;color: #2C2C2C;margin: 25rpx 0 20rpx 0;">{{dad.nick_name}}</view>
								<view style="font-size: 23rpx;color: #B5B5B5;width: 350rpx;">{{dad.hometown}}</view>
							</view>
							<view v-if="gou_yong == 22">
								<view style="font-size: 30rpx;font-weight: bold;color: #2C2C2C;margin: 25rpx 0 20rpx 0;">{{mechanism_name}}</view>
								<view style="font-size: 23rpx;color: #B5B5B5;width: 350rpx;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">{{mechanism_addr}}</view>
							</view>
						</view>
						<view>
							<view v-if="gou_yong == 22" @tap="jigou">
								<text style="color: #B5B5B5;font-size: 32rpx;">机构资料</text>
								<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
							</view>
							<view v-if="gou_yong == 12" @tap="goyonghu">
								<text style="color: #B5B5B5;font-size: 32rpx;">用户资料</text>
								<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
							</view>
						</view>
					</view>
				</view>
				<view v-if="!dad">
					<image :src="weideng" style="width: 115.6rpx;height: 115.6rpx;border-radius: 50%;"></image>
				</view>
				<view style="margin-left: 23rpx;display: flex;justify-content: space-between;align-items: center;width: 480rpx;" v-if="!dad" @tap.stop="zhuce">
					<view style="font-weight: bold;">
						<view style="font-size: 33rpx;color: #2C2C2C;" >登录 / 注册</view>
						<view style="color: #B5B5B5;font-size: 24rpx;margin-top:3rpx ;">请先登录</view>
					</view>
					<view>
						<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
					</view>
				</view>
			</view>
			<view style="width: 100%;box-sizing: border-box;padding: 0 59rpx;display: flex;justify-content: space-between;margin-top: 35rpx;" v-if="gou_yong == 12">
				<view class="dibu" @tap.stop="kandingdan">
					<view class="dibu_shu">{{dingdan_shang}}</view>
					<view>我的订单</view>
				</view>
				<view class="dibu" @tap.stop="add">
					<view class="dibu_shu">{{kaquan}}</view>
					<view>我的卡券</view>
				</view>
				<view class="dibu" @tap.stop="kanjifen">
					<view class="dibu_shu">{{jifen}}</view>
					<view>我的积分</view>
				</view>
			</view>
		</view>
		<view style="position: relative;width: 100%;margin-top: 10rpx;top: -100rpx;">
			<image :src="guanggao" mode="" style="width: 694.6rpx;height: 138.92rpx;margin-left:27.77rpx ;"></image>
		</view>
		<view class="body2" v-if="dad">
			<view class="shang" v-if="num1 == 3" @tap="goshenfen_" style="position: relative;left: 10rpx;">
				<view class="int">
					<image src="http://img.curiousmore.com/132636593648" mode="" class="img" ></image>
					<text>切换身份</text>
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;position: relative;left: -10rpx;"></image>
				</view>
			</view>
			<view class="shang" v-if="gou_yong == 22" @tap="gotoshang">
				<view class="int">
					<image :src="kecheng" mode="" class="img"></image>
					<text>课程管理</text>
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" v-if="num == 2" @tap="gojigou">
				<view class="int" >
					<image :src="ruzhu" mode="" class="img"></image>
					机构入驻
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" v-if="gou_yong == 22" @tap="gojigou_teater">
				<view class="int">
					<image :src="jigou_laoshi" mode="" class="img"></image>
					老师管理
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" v-if="gou_yong == 22" @tap="gojigou_jiaoshi">
				<view class="int">
					<image :src="jiaoshi" mode="" class="img"></image>
					教室管理
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" v-if="gou_yong == 22" @tap="gokehu">
				<view class="int">
					<image :src="kehuguanli" mode="" class="img"></image>
					客户管理
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			
			<view class="shang" @tap="goExcell">
				<view class="int" >
					<image :src="you" mode="" class="img"></image>
					优学卡
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" @tap="goDrawal">
				<view class="int" >
					<image :src="addMomey" mode="" class="img"></image>
					提现
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" @tap="goshenfen">
				<view class="int" >
					<image :src="yijian" mode="" class="img"></image>
					意见反馈
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
			<view class="shang" style="border: none;" @tap="shezhi">
				<view class="int">
					<image :src="shezhi_" mode="" class="img"></image>
					设置
				</view>
				<view>
					<image :src="zhijian" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	var wv;
	export default {
		data() {
			return{
				you: "http://img.curiousmore.com/593871882651",
				biao_tou: "http://img.curiousmore.com/677938",
				dad:{},
				num:1,
				num1:2,
				num3:3,
				content_:"",
				webviewStyles: {
					progress: {
						color: '#FF3333'
					}
				},
				show:false,
				url:'',
				dingdan_shang: 0,
				kaquan: 0,
				jifen: 0,
				user_id: "",
				mechanism_id: "",
				gou_yong: 12,
				// 判断机构或者用户 12 用户 22 机构
				mechanism_name: "",
				mechanism_addr: "",
				mechanism_logo: "",
				shezhi_: "http://img.curiousmore.com/305577",
				yijian: "http://img.curiousmore.com/676455",
				jigou_laoshi: "http://img.curiousmore.com/650909",
				kecheng: "http://img.curiousmore.com/675987",
				kehuguanli: "http://img.curiousmore.com/664225",
				ruzhu: "http://img.curiousmore.com/623621",
				jiaoshi: "http://img.curiousmore.com/741791",
				guanggao: "http://img.curiousmore.com/867642",
				weideng: "http://img.curiousmore.com/337658",
				kaquan_: "http://img.curiousmore.com/752801",
				zhijian: "http://img.curiousmore.com/578648",
				addMomey: "http://img.curiousmore.com/303090522908"
			}
		},
		onLoad() {
			let me = this
			try{
				if(uni.getStorageSync('userif_list')){
					this.dad = uni.getStorageSync('userif_list')
					this.user_id = uni.getStorageSync('userif_list').user_id
					this.mechanism_id = uni.getStorageSync('userif_list').mechanism_id
					if(this.mechanism_id != 0){
						this.jigou_xiang()
					}
				}
				if(uni.getStorageSync('shenfen_')){
					let list = uni.getStorageSync('shenfen_')
					if(list == 33){
						me.gou_yong = 12
					}else if(list == 55){
						me.gou_yong = 22
					}
				}else{
					me.gou_yong = 12
				}
				this.dad = uni.getStorageSync('userif_list')
			}catch(res){}
			if(this.dad.admin_id == 0 && this.dad.mechanism_id == 0){
				this.num = 2
				me.content_ = "个人资料"
			}else if(this.dad.mechanism_id != 0){
				this.num1 = 3
				me.content_ = "机构资料"
			}
			if(this.dad.mechanism_id == 0){
				try{
					uni.setStorageSync('shenfen',1)
				}catch(err){}
			}
			this.panduan()
			this.userStatistics()
		},
		onShow() {
			
		},
		methods:{
			
			// 
			jigou() {
				uni.navigateTo({
					url: "/pages/Other/contact/contact"
				})
			},
			
			// 优学卡购买列表
			goExcell() {
				
				uni.navigateTo({
					url: "/pages/Other/DetailsCurriculum/DetailsCurriculum"
				})
			},
				gojigou_jiaoshi(){
					uni.navigateTo({
						url: "/pages/Friend/findGroup/findGroup"
					})
				},
				gokehu(){
					uni.navigateTo({
						url: "/pages/Friend/findSomeone/findSomeone"
					})
				},
				goshenfen_(){
					uni.navigateTo({
						url: "/pages/World/videoDetails/videoDetails"
					})
				},
				kanjifen(){
					if(this.user_id != ""){
						uni.navigateTo({
							url: "/pages/Friend/groupSet/groupSet"
						})
					}else{
						uni.showToast({
							title: "请先登录",
							icon: "none"
						})
					}
				},
			    kandingdan(){
					if(this.user_id != ""){
						uni.navigateTo({
							url: "/pages/Friend/search/search"
						})
					}else{
						uni.showToast({
							title: "请先登录",
							icon: "none"
						})
					}
				},
				add(){
					if(this.dad != ""){
						uni.navigateTo({
							url:"/pages/Friend/hudong/hudong"
						})
					}else{
						uni.showToast({
							title: "请先登录",
							icon: "none"
						})
					}
				},
		async	userStatistics(){
			    if(this.user_id != ""){
					const res = await this.$myRequest({
						url:"/userInfo/queryTeachPayUserStatistics",
						data:{
							user_id: this.user_id
						}
					})
					if(res.code == 0){
						this.dingdan_shang = res.data.rechargeCount
						this.kaquan = res.data.coupNum
						this.jifen = res.data.points
					}
				}
			},
			gojigou_teater(){
				uni.navigateTo({
					url:"/pages/Other/tuijianfriend/tuijianfriend"
				})
			},
			gotoshang(){
				uni.navigateTo({
					url:"/pages/World/myCuriosity/myCuriosity"
				})
			},
			dingdan(){
				
			},
			goshenfen(){
				uni.navigateTo({
					url:'/pages/Friend/getRed/getRed'
					// url:'/pages/My/jigou/jigou'
				})
			},
			zhuce(){
				uni.reLaunch({
					url:'/pages/tabBer/login/logins'
				})
			},
			panduan(){
				if(!this.dad){
					uni.showModal({
						content:"登录体验更多功能",
						confirmText:"登录",
						cancelText:"取消",
						success: (res) => {
							if(res.confirm){
								uni. navigateTo({
									url:'/pages/tabBer/login/logins'
								})
							}
						}
					})
				}
			},
			shezhi(){
				if(!this.dad){
					this.panduan()
				}else{
					uni.navigateTo({
						url:'/pages/My/set/set'
					})
				}
			},
			gojigou(){
				let me = this
				me.show = true
				try{
					if(uni.getStorageSync("Settle")){
						uni.showToast({
							title: "您已经注册过了，请耐心等待",
							icon: "none"
						})
					}else {
						uni.navigateTo({
							url:'/pages/My/jigou/jigou'
						})
					}
				}catch(e){}
				
			},
		async	jigou_xiang(){
				const res = await this.$myRequest({
					url:"/mastermechanism/queryMechanismListPage",
					data:{
						id: this.mechanism_id,
						type: "teach_paypal",
						pageSize: "1"
					}
				})
				this.mechanism_name = res.data[0].mechanism_name
				this.mechanism_addr = res.data[0].mechanism_addr
				this.mechanism_logo = res.data[0].mechanism_logo
			},
			goyonghu(){
				uni.navigateTo({
					url: "/pages/Friend/groupSay/groupSay"
				})
			},
			
			// 提现页面
			goDrawal() {
				uni.navigateTo({
					url: "/pages/Other/DetailsClassroom/DetailsClassroom"
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.body2{
		position: relative;
		// top: 678.88rpx;
		top: -100rpx;
		width: 694.6rpx;
		border-radius: 30.2rpx;
		margin-left: 30.2rpx;
		background: #FFFFFF;
		box-sizing:border-box;
		padding:32rpx 39.86rpx 39.86rpx 39.86rpx;
		display: flex;
		flex-direction: column;
		font-size: 27.77rpx;
		color: #393939;
		font-family: PingFang-SC-Regular;
		margin-bottom:96rpx;
		.shang{
			height: 59.2rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding:23rpx 0;
			border-bottom:1px solid #DBDBDB;
			.int{
				display: flex;
				align-items: center;
				.img{
					width: 59.2rpx;
					height: 59.2rpx;
				}
			}
		}
	}
	.dibu{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		font-size: 27rpx;
		color: #393939;
		.dibu_shu{
			font-size: 32rpx;
			font-weight: bold;
			margin-bottom: 5rpx;
		}
	}
</style>